* {
  box-sizing: border-box;
}
body {
  background-color: #efedd6;
  display: flex;
  flex-direction: column; /* 垂直排列 */
  justify-content: center; /* 垂直居中 */
  align-items: center; /* 水平居中 */
  margin: 0;
  overflow-x: hidden; /* 隐藏滚动条 */
}
h1 {
  margin: 10px;
}
.box {
  background-color: steelblue;
  color: #fff;
  display: flex;
  align-items: center; /* 水平居中 */
  justify-content: center; /* 垂直居中 */
  width: 400px;
  height: 200px;
  margin: 10px;
  border-radius: 10px;
  box-shadow: 2px 4px 5px rgba(0, 0, 0, 0.3);
  transform: translateX(400%);
  transition: transform 0.5s ease; /* 过渡效果 ease: 缓动函数 */
}
.box:nth-child(2n) {
  transform: translateX(-400%);
  background-color: red;
}
.box.show {
  transform: translateX(0);
}
.box h2 {
  font-size: 65px;
}